Presentation

Scene graph

Scene graph defines the content structure and its layout on the screen. The scene graph is constructed from nodes that display content (for example, Image node) and implement logic (for example, Button 2D node). The same scene graph supports 2D and 3D nodes and provides the means to connect them. The relationship between the nodes in the scene graph is very important and defines how several Kanzi core technologies work. Rendering order, layout, property and resource inheritance, and input and message propagation all depend on the relationship between parent and child nodes in the scene graph. Kanzi offers the tools to modularize and reuse parts of the scene graph (for example, prefabs).

Nodes available in Kanzi

Content control nodes

Interactivity control nodes

Layout control nodes

Container control nodes

3D nodes

Class hierarchy organization

The base class is Node. The base class for 2D nodes is Node2D and allows adding 2D nodes as child nodes. Node3D works in the same way for 3D nodes. Node class does not have the means to connect child nodes, so that the Node2D, Node3D, and derived classes can define what types of nodes they accept as child nodes. For example, Viewport 2D derives from the Node2D class and therefore accepts 2D child nodes, but also accepts one child node of the type Scene. This way Kanzi can arrange 2D and 3D nodes in a heterogeneous graph.

To iterate the graph in a homogeneous way use the Visitor or Abstract Child APIs:

Each node has the access to its parent. The type of parent pointer is Node because the type of the parent can be either 2D or 3D.

See Kanzi scene graph class hierarchy.